package com.yc.demo.d0730;

import com.yc.demo.util.Utils;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "OnlineServlet", value = "/online.s")
public class OnlineServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 获取上下文对象
        request.getServletContext();
        request.getSession().getServletContext();
        final ServletContext servletContext = this.getServletContext();
        // 提取集合
        final Object onlineMap = servletContext.getAttribute("onlineMap");
        Utils.result(response, onlineMap);
    }
}
